<template>
  <div class="base-info" v-if="Object.keys(goods).length !==0">
		<div class="base-title">{{goods.title}}</div>
		<div class="base-price">
			<span class="base-newprice">￥{{goods.realPrice}}</span>
			<span class="base-oldprice">{{goods.oldPrice}}</span>
			<span class="base-discount" v-show="goods.discount">{{goods.discount}}</span>
		</div>
		<div class="base-columns">
			<span class="base-coloums-item">{{goods.columns[0]}}</span>
			<span class="base-coloums-item">{{goods.columns[1]}}</span>
			<span class="base-coloums-item">{{goods.services[goods.services.length-1].name}}</span>
		</div>
		<div class="base-services">
				<div v-for="(item, index) in goods.services" :key="index" class="base-services-item" v-show="index != goods.services.length-1">
					<img :src="item.icon">
					<span>{{item.name}}</span>
				</div>
		</div>

  </div>
</template>

<script>
  //这里可以导入其他文件（比如：组件，工具js，第三方插件js，json文件，图片文件等等）
  //例如：import 《组件名称》 from '《组件路径》';

  export default {
    name: 'DetailBaseInfo',
    components: {},
    props: {
			goods:{
				type: Object,
        default(){
          return {}
        }
			}
    },
    data() {
    //这里存放数据
      return {

      };
    },
    //计算属性 类似于data概念
    computed: {},
    //监控data中的数据变化
    watch: {},
    //方法集合
    methods: {

    },
    //生命周期 - 创建完成（可以访问当前this实例）
    created() {

    },
    //生命周期 - 挂载完成（可以访问DOM元素）
    mounted() {

    },
    beforeCreate() {}, //生命周期 - 创建之前
    beforeMount() {}, //生命周期 - 挂载之前
    beforeUpdate() {}, //生命周期 - 更新之前
    updated() {}, //生命周期 - 更新之后
    beforeDestroy() {}, //生命周期 - 销毁之前
    destroyed() {}, //生命周期 - 销毁完成
    activated() {}, //如果页面有keep-alive缓存功能，这个函数会触发
  }
</script>
<style scoped>
.base-info{
  width: 100%;
}
.base-title{
  font-size: var(--font-size);
  padding: 0.5rem 0.3125rem;
}
.base-price{
  margin: 0 0.3125rem 0.625rem 0.3125rem;
}
.base-newprice{
  color: var(--color-high-text);
  font-size: 1.25rem;
}
.base-oldprice{
  color: var(--color-text);
  font-size: 0.75rem;
  text-decoration: line-through;
}
.base-discount{
  background-color: var(--color-high-text);
  font-size: 0.625rem;
  line-height: 0.75rem;
  border-radius: 0.375rem;
  color: #fff;
  text-align: center;
  position: relative;
  top: -0.3125rem;
  left: 0.3125rem;
  padding: 0.125rem;
}
.base-columns{
  display: flex;
  margin: 0 0.3125rem;
  padding-bottom: 0.3125rem;
  border-bottom: 0.125rem solid #F6F6F6;
}
.base-coloums-item{
  flex: 1;
  text-align: center;
  font-size: 0.75rem;
  color: #B0B0B0;
}
.base-coloums-item:first-child{
  text-align: left;
}
.base-coloums-item:last-child{
  text-align: right;
}
.base-services{
  display: flex;
  margin: 0.625rem 0.3125rem 0 0.3125rem;
  padding-bottom: 0.625rem;
  border-bottom: 0.3125rem solid #F6F6F6;
}
.base-services-item{
  flex: 1;
  text-align: center;
}
.base-services-item>img{
  width: 0.75rem;
  height: 0.75rem;
}
.base-services-item>span{
  font-size: 0.375rem;
}

</style>